<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
     // 3. 封装函数，求得传入数组⾥⼤于 5 的和 [4, 9, 6, 90, 3, 11]
    //  function getLargeSum(arr) {
    //   const arr2=[]
    //   const arr1=arr.map(item=>{
    //     if(item>5){
    //       arr2.push(item)
    //     }
    //   })
    //   const sum=arr2.reduce((sums,item)=>{
    //     return sums +item
    //   })
    //   return sum
    //  }
    //   let arr3 = [4, 9, 6, 90, 3, 11]
    //   let sum3 = getLargeSum(arr3)
    //   console.log(sum3);

    function getLargeSum(arr) {
      return arr.filter(item=>item>5).reduce((sums,item)=>{
        return sums +item
      })
    }
      let arr3 = [4, 9, 6, 90, 3, 11]
      let sum3 = getLargeSum(arr3)
      console.log(sum3);
  </script>
</body>
</html>